<me:UITMKRF  x:Class="WPFExcelReport.TMRILI"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
     xmlns:AM="clr-namespace:WPFExcelReport;assembly=TAMSTAMM"
    xmlns:me="clr-namespace:WPFExcelReport"
              xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"   
                    xmlns:KS="clr-namespace:WPFExcelReport;assembly=TKSTSTELL"  
              xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"   
             FontSize="16"
    x:Name="TV"
    Loaded="Window_Loaded"
 >
    <me:UITMKRF.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:PNumConverter x:Key="pnum"/>
        <ucd:Divideby1440  x:Key="day"/>
        <ucd:Divideby480  x:Key="shift"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:BoolToVisibilityConverter x:Key="bv"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UITMKRF.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel>
            <WrapPanel Grid.Row="0" Grid.Column="0">
                <Button  Width="24" Height="20" Margin="10,0,0,0"  Click="btnRefreshMachine_Click">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Refresh.png" />
                    </Button.Background>
                </Button>
                <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="EditCommand" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                    </Button.Background>
                </Button>
                <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="SaveCommand" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                    </Button.Background>
                </Button>
                <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="DeleteCommand" IsEnabled="{Binding IsEdit,ElementName=TV}" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button>
                <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="btnRLToAll_Click">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Convert.png" />
                    </Button.Background>
                </Button>
                <TextBlock  FontSize="18" VerticalAlignment="Center" Visibility="Collapsed"
                        Text="{Binding Source={Localization:TranslateExtension Word=复制到所有}}"/>

                <TextBlock Text="{Binding Source={Localization:Translate Word=成本中心}}"/>
                <ex:TXT72 Text="{Binding KSTKRS,ElementName=TV}" MaxLength="2"  Width="30"/>
                <ex:TXT72 Text="{Binding KST,ElementName=TV}" MaxLength="4"  Width="40"/>
                <KS:TSKS03 Grid.Column="1"  
                                  IsEdit="True"
                                   KEY="{Binding Path=AMKST,ElementName=TV}" />
                <TextBlock Text="{Binding Source={Localization:Translate Word=设备类型}}"/>
                <ex:TXT72 Text="{Binding AMTYP,ElementName=TV}" MaxLength="8"  Width="60"/>
                <SD:K0228 
                            KEY="{Binding AMTYP,ElementName=TV}" 
                          IsEdit="True"  />
                <Button  Width="24" Height="20" Margin="10,0,0,0"  Click="QueryCommand">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/search.png" />
                    </Button.Background>
                </Button>
            </WrapPanel>
            <WrapPanel>
                <WrapPanel>
                    <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="NewCommand">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                        <AM:TSAM02
                          KSTKRS="{Binding KSTKRS,ElementName=TV}"
                          KST="{Binding KST,ElementName=TV}"
                          AMTYP="{Binding AMTYP,ElementName=TV}"
                          IsEdit="True"
                         KEY="{Binding MACHINEID,ElementName=TV}"/>
                        <Label Content="{Binding Source={Localization:Translate Word=发生日期}}"   HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"  Width="Auto" FontSize="16" />
                        <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0"  FontSize="16"   Panel.ZIndex="4" Width="150"
                            Text="{Binding DTSTART,ElementName=TV}" SelectedDateChanged ="DTSTART_SelectedDateChanged"  />
                        <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="NewCommand">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                            </Button.Background>
                        </Button>
                    </WrapPanel>
                </WrapPanel>
                <WrapPanel>
                    <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="CopyCommand">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Copy.png" />
                        </Button.Background>
                    </Button>
                    <WrapPanel Visibility="{Binding IsCopy,ElementName=TV,Converter={StaticResource bv}}">
                        <AM:TSAM02 Name="cAM02"
                          KSTKRS="{Binding KSTKRS,ElementName=TV}"
                          KST="{Binding KST,ElementName=TV}"
                          AMTYP="{Binding AMTYP,ElementName=TV}"
                        dwAM="{Binding dwTAM,ElementName=TV}"/>
                        <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="CopyCommand">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                            </Button.Background>
                        </Button>
                    </WrapPanel>
                </WrapPanel>               
            </WrapPanel>
            <WrapPanel> 
                <Button Height="20" Width="60"    Margin="10,0,0,0"  Click="WDCommand" Content="{Binding Source={Localization:Translate Word=温度切换}}"/>
                <Button  Width="24" Height="20" Margin="10,0,0,0"  Click="QueryWDCommand">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/search.png" />
                    </Button.Background>
                </Button>
                <AM:TSAM02
                          KSTKRS="{Binding KSTKRS,ElementName=TV}"
                          KST="{Binding KST,ElementName=TV}"
                          AMTYP="{Binding AMTYP,ElementName=TV}"
                          IsEdit="True"
                         KEY="{Binding MACHINEID,ElementName=TV}"/>
                <TextBlock Grid.Row="4" Grid.Column="1"    Text="{Binding MKFPLDATV, Mode=TwoWay}"   
                         VerticalAlignment="Top" Width="100" />
                <WrapPanel Visibility="{Binding IsWD,ElementName=TV,Converter={StaticResource bv}}"> 
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*"></ColumnDefinition>
                            <ColumnDefinition Width="1*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Row="5" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=开始时间:}}"  HorizontalAlignment="Right"   Height="18"      TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                        <TextBox Grid.Row="5" Grid.Column="1"    Text="{Binding MKFPLTIME, Mode=TwoWay}"   VerticalAlignment="Top"  Width="100" />
                    </Grid>
                    <TextBlock Grid.Row="4" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=间隔分钟:}}"/>
                    <TextBox  Background="White"  BorderBrush="Black"  Width="80"   Margin="1,0,0,0" Text="{Binding ABFAMASCHZT}"/>
                    <Button Height="20" Width="24"      Margin="10,0,0,0"  Click="WDCommand">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel>
        </StackPanel>
        <StackPanel  Grid.Row="1" Grid.Column="0">         
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0"    HorizontalAlignment="Right"  
                           Margin="0,0,0,0"    VerticalAlignment="Center"   Width="Auto"   TextAlignment="Right"   Text="{Binding Source={Localization:Translate Word=ID:}}" />
                <TextBlock  Grid.Row="0" Grid.Column="1"   HorizontalAlignment="Left" 
                            TextWrapping="Wrap"   Text="{Binding ABAID}"   VerticalAlignment="Top" />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="2" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=类型:}}"  HorizontalAlignment="Right"   Height="18"    
                           TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                <TextBlock Grid.Row="2" Grid.Column="1"    Text="{Binding JOBTYPE, Mode=TwoWay}" 
                           VerticalAlignment="Top" />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="1" Grid.Column="0"   HorizontalAlignment="Right"   Height="18"      TextWrapping="Wrap"   VerticalAlignment="Top"   TextAlignment="Right"   Text="{Binding Source={Localization:Translate Word=单号:}}" />
                <WrapPanel Grid.Row="1" Grid.Column="1" >
                    <TextBlock    Text="{Binding ABFAUFKRS}"   VerticalAlignment="Top" />
                    <TextBlock    Text="{Binding ABFAUFLFD}"   VerticalAlignment="Top" />
                    <TextBlock    Text="{Binding ABFAUFPOS}"   VerticalAlignment="Top" />
                </WrapPanel>
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="2" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=任务号:}}"  HorizontalAlignment="Right"   Height="18"    
                           TextWrapping="Wrap"   VerticalAlignment="Top" TextAlignment="Right"/>
                <TextBlock Grid.Row="2" Grid.Column="1"    Text="{Binding MKFTP}"  Width="60"
                           VerticalAlignment="Top" />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="6" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=任务:}}"  HorizontalAlignment="Right"   Height="18"   
                           TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                <ex:TXT72 Grid.Row="6" Grid.Column="1"  
                          Text="{Binding ABPART,Converter={StaticResource gb2312}, Mode=TwoWay}"  
                          MaxLength="20" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                         VerticalAlignment="Top"  Width="100"  />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="3" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=设备:}}"  HorizontalAlignment="Right"   Height="18"     
                           TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                <WrapPanel Grid.Row="3" Grid.Column="1"  >
                    <TextBlock   Text="{Binding MACHINEID, Mode=TwoWay}"   VerticalAlignment="Top"  Width="100" />
                </WrapPanel>
            </Grid>
            <WrapPanel>

                <TextBlock Grid.Row="4" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=开始日期:}}" 
                           HorizontalAlignment="Right"   Height="18"      TextWrapping="Wrap"   
                           VerticalAlignment="Top"    TextAlignment="Right"   />
                <DatePicker Height="25" Grid.Column="1"  HorizontalAlignment="Left" Margin="0,2,0,0"  FontSize="16"   
                            Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"
                            Text="{Binding DTSTART,ElementName=TV}" SelectedDateChanged ="DTSTART_SelectedDateChanged"  />
                <TextBox Grid.Row="4" Grid.Column="2"    Text="{Binding MKFPLDATV, Mode=TwoWay}"   
                         VerticalAlignment="Top" Width="100" />
            </WrapPanel>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="5" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=开始时间:}}"  HorizontalAlignment="Right"   Height="18"      TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                <TextBox Grid.Row="5" Grid.Column="1"    Text="{Binding MKFPLTIME, Mode=TwoWay}"   VerticalAlignment="Top"  Width="100" />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="6" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=持续时间:}}"  HorizontalAlignment="Right"   Height="18"      TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                <ex:NumericBox Grid.Row="6" Grid.Column="1"    Text="{Binding QTY,ElementName=TV}" KeyUp="QTY_KeyUp"   VerticalAlignment="Top"  Width="100" />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="5" Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=结束日期:}}"  HorizontalAlignment="Right"  
                           Height="18"      TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                <TextBox Grid.Row="5" Grid.Column="1"    Text="{Binding ENDATE,  Mode=TwoWay}"   
                         VerticalAlignment="Top"  Width="100"  />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="2*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock  Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=结束时间:}}"  HorizontalAlignment="Right" 
                            Height="18"      TextWrapping="Wrap"   VerticalAlignment="Top"     TextAlignment="Right"   />
                <TextBox   Grid.Column="1"    Text="{Binding ENDTIME,Mode=TwoWay}"  
                           VerticalAlignment="Top"  Width="100" />
                <TextBlock Text="{Binding Path=ART, ElementName=TV}" Width="Auto" 
                           Margin="5,0,0,0"></TextBlock>
            </Grid> 
        </StackPanel>
       
        <DataGrid  Grid.Row="2" Grid.Column="0"   
                   CanUserReorderColumns="True"  
                           
                          CanUserResizeRows="True" CanUserSortColumns="True"                  
                          AutoGenerateColumns="False"   
                          EnableRowVirtualization="True"  
                          RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                          IsSynchronizedWithCurrentItem="True" Opacity="10"  
                          ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                           x:Name="dlgMaster" 
                  >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=ABAID}" Header="{Binding Source={Localization:TranslateExtension Word=确认}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABPART,Converter={StaticResource ResourceKey=gb2312}}" Header="{Binding Source={Localization:TranslateExtension Word=事件}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFAUFKRS}" Header=" "  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFAUFLFD, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=任务号码}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFAUFPOS, Converter={StaticResource ResourceKey=pnum}}" Header=" "  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MKFTP, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=编号}}"  Width="Auto" />
                <DataGridTextColumn FontSize="14" Foreground="Red" Binding="{Binding Path=ABFBNRKRS}" Header=" "  Width="Auto" />
                <DataGridTextColumn FontSize="14" Foreground="Red" Binding="{Binding Path=ABFBLFDNR, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=机台}}"  Width="Auto" />
                <DataGridTextColumn FontSize="14" Foreground="Red"  Binding="{Binding Path=ABFBPOS, Converter={StaticResource ResourceKey=pnum}}" Header=" "  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MKFPLDATV}" Header="{Binding Source={Localization:TranslateExtension Word=开始}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MKFPLTIME}" Header="{Binding Source={Localization:TranslateExtension Word=时间}}"  Width="Auto" /> 
                <DataGridTextColumn Binding="{Binding Path=ABFAMASCHZT}" Header="{Binding Source={Localization:TranslateExtension Word=持续时间}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ENDATE}" Header="{Binding Source={Localization:TranslateExtension Word=结束}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ENDTIME}" Header="{Binding Source={Localization:TranslateExtension Word=时间}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JOTBYPE}" Header="{Binding Source={Localization:TranslateExtension Word=类型}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JP02}" Header="{Binding Source={Localization:TranslateExtension Word=温度}}"  Width="Auto" />

            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UITMKRF>
